home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / os.483 < prev    next >
Text File  |  1992-02-06  |  1KB  |  23 lines

  1. power off shutdown halt
  2.  
  3. Q: Can I interpose a program of my own design in the midst of the power-off sequence?
  4.  
  5. Q: What happens when someone presses the Power key when the system is running?
  6.  
  7. A: If the Workspace Manager is running, or if loginwindow is running, yes,  you might be able to interpose something.  If neither of these is running, no, there's nothing you can do.
  8.  
  9. When the power key is pressed, a POWER interrupt occurs.  [This interrupt is called I_POWER and is defined in /usr/include/next/cpu.h, for those curious.]   If the window server is running, the interrupt is passed to it; it then passes the interrupt on to the Workspace Manager or to loginwindow, as appropriate.   The WM or lw will then request confirmation from the user; if the power-off is confirmed, they both exec halt(8), passing it the -e and the -p options (eject the OD, and power-off).  You could replace
  10.  
  11.     /etc/halt
  12.  
  13. with a program (compiled or shell script) of your own design, which would eventually exec the real halt.  Note that it must pass along its arguments to the real halt.
  14.  
  15. If neither the WM nor the lw is running, the kernel handles the power interrupt; things never get out to the level of user code.
  16.  
  17. QA483
  18.  
  19. Valid for 1.0 
  20. Valid for 2.0 
  21.  
  22.  
  23.